package com.vip.mm;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Random;

/**
 * 梦想工具类
 */
public class MxUtils {

    public static List<String> getMx(int size){
        System.out.println(" 成就吴泽锋百万富翁的中奖号码已生成！ ");
        // Thread.sleep(2000);
        System.out.println(" 请稍等马上为您揭晓,系统准备中！ ");
        String result = "";
        int redInt = 33;
        int blueInt = 16;
        List<String> collect = new ArrayList<>();
        for (int j = 0; j < size; j++) {
            List<String> money = new ArrayList<>();
            Random random = new Random();
            while (true) {
                String redNum = addZero(random.nextInt(redInt) + 1);
                boolean isExits = money.contains(redNum);
                if (!isExits) {
                    money.add(redNum);
                    if (money.size() == 6)
                        break;
                }
            }
            Collections.sort(money);
            String blueNum = addZero(random.nextInt(blueInt) + 1);
            for (int i = 10; i < 1; i--) {
                // Thread.sleep(1000);
                System.out.println(" 中奖号码揭晓倒计时: " + i + "S ");
            }
            for (String m : money) {
                // Thread.sleep(1000);
                System.out.println(" 红球号码: " + m);
                result += "".equals(result)?m:" - " + m;
            }
            // Thread.sleep(1000);
            System.out.println(" 蓝球号码: " + blueNum);
            // Thread.sleep(1000);
            System.out.println(" 中奖结果:" + result + " - " + blueNum);
            collect.add(result + " - " + blueNum);
            result = "";
        }
        System.out.println(" ");
        System.out.println(" ");
        System.out.println(" ");
        System.out.println(" 汇总生成中,请稍等！ ");
        String results = "";
        return collect;
    }

    public static String addZero(int redNum) {
        if (redNum < 10) {
            return "0" + redNum;
        }
        return "" + redNum;
    }

}
